package cn.cnlee.app.util;

import android.content.Context;

import com.adapter.adapter.DelegateAdapter;

import java.util.ArrayList;

import cn.cnlee.app.pojo.BannerListVo;
import cn.cnlee.app.pojo.CategoryListVo;
import cn.cnlee.app.pojo.NewsDTO;
import cn.cnlee.app.pojo.NewsListVo;
import cn.cnlee.app.ui.home.holder.BannerItemHolder;
import cn.cnlee.app.ui.home.holder.CategoryItemHolder;
import cn.cnlee.app.ui.home.holder.NewsItemHolder;

/**
 *
 */
public class AdapterPool {

    private static AdapterPool adapterPool;

    public static AdapterPool newInstance() {
        if (adapterPool == null) {
            synchronized (AdapterPool.class) {
                if (adapterPool == null) {
                    adapterPool = new AdapterPool();
                }
            }
        }
        return adapterPool;
    }

    public DelegateAdapter.Builder getModuleAdapter(Context context) {
        return new DelegateAdapter.Builder<>()
                .bind(BannerListVo.class, new BannerItemHolder(context))
                .bind(CategoryListVo.class, new CategoryItemHolder(context))
                .bind(NewsDTO.class, new NewsItemHolder(context));
    }

}
